<template>
    <div>
        <div v-if="tbAdList.length">
            <u-swiper :list="tbAdList" name="thumbnailUrl" duration="1000" :height="globalVariable.userInfo.tbCommunity.tbCommunityHomeConfig.adHeight"
                      img-mode="scaleToFill" :autoplay="true" :circular="false"
                      @click="clickItem"></u-swiper>
        </div>
    </div>
</template>

<script>
    import {TbAdService} from "../../dev/services/tb-ad.service";

    export default {
        data: function () {
            return {
                tbAdList: [],
            }
        },
        components: {},
        mounted() {
            const _self = this;
            new TbAdService().findTbAdListCascade({
                fkId: this.globalVariable.userInfo.tbCommunity.tbCommunityHomeConfig.id,
                status: "1",
                deleted: 0,
                isFindValidTimeRange: true,
                orderBy: 'display_order asc'
            }).then(result => {
                _self.tbAdList = result;
            })
        },
        methods: {
            clickItem(index) {
                const _self = this;
                console.log(index);
                new TbAdService().navByType(_self, _self.tbAdList[index]);
            }
        },
    }
</script>

<style lang="scss" scoped>
</style>
